package persistence;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class PersistenceUtil {
	private static PersistenceConfiguration configuration;
	private static PersistenceSessionFactory factory;
	private static Logger log = LoggerFactory.getLogger(PersistenceSessionFactory.class);
  
 	 static {
 		 try {
 			 configuration = new PersistenceConfiguration();
 			 factory = configuration.getPersistenceSessionFactory();
 		 }
 		 catch (Throwable ex) {
 			 log.error("Building PersistenceContextFactory failed.", ex);
 			 throw new ExceptionInInitializerError(ex);
 		 }
 	 }
 	 
 	 public static PersistenceConfiguration getConfiguration() {
 		 return configuration;
 	 }
 	 public static PersistenceSessionFactory getFactory() {
 		 return factory;
 	 }
}
